package com.itlong.cloud.enumerate;

/**
 * <desc>
 *      项目是否开启云对讲状态枚举
 * </desc>
 *
 * @createDate 2017/10/30
 */
public enum ProjectSmartCommunityStatusEnum {
    PROJECT_SMART_COMMUNITY_YES("是", 1),            //是否启用云对讲，1-是
    PROJECT_SMART_COMMUNITY_NO("否", 0),          //是否启用云对讲，默认0,0-否

    ;
    private String description;
    private Integer type;

    /**
     * <desc>
     *      项目是否开启云对讲状态状态枚举无参构造函数
     * </desc>
     * @param
     * @return
     * @author zhangs
     * @createDate 2017/10/30
     */
    ProjectSmartCommunityStatusEnum() {
    }

    /**
     * <desc>
     *      项目是否开启云对讲状态枚举描述与类型构造函数
     * </desc>
     * @param description 描述
     * @param type 类型
     * @return
     * @author zhangs
     * @createDate 2017/10/30
     */
    ProjectSmartCommunityStatusEnum(String description, Integer type) {
        this.description = description;
        this.type = type;
    }

    /**
     * <desc>
     *      获取项目是否开启云对讲状态枚举描述
     * </desc>
     * @param
     * @return String
     * @author zhangs
     * @createDate 2017/10/30
     */
    public String getDescription() {
        return description;
    }

    /**
     * <desc>
     *      获取项目是否开启云对讲状态枚举类型
     * </desc>
     * @param
     * @return Integer
     * @author zhangs
     * @createDate 2017/10/30
     */
    public Integer getType() {
        return type;
    }

    /**
     * <desc>
     *      获取枚举的描述
     * </desc>
     * @param type 枚举类型
     * @return 枚举描述
     * @author zhangs
     * @createDate 2017/10/30
     */
    public static String getDescription(Integer type){
        ProjectSmartCommunityStatusEnum[] types = ProjectSmartCommunityStatusEnum.values();
        for(ProjectSmartCommunityStatusEnum limitCategory : types ){
            if(limitCategory.getType() == type){
                return limitCategory.getDescription();
            }
        }
        return null;
    }
}
